//封装axios请求
import axios from 'axios'

export function request(config) {
  //创建axios实例
  const instance = axios.create({
    baseURL: 'http://localhost:20558/',
    timeout: 5000,
    'Content-Type': 'application/x-www-form-urlencoded'

    //withCredentials: true,
    //Cookie: '__RequestVerificationToken=4ga5syLiFEJgg8Xmsgj6EHVSc-ThKY6EeFkgew1LeE4kUuHZcTjZvqdYHLtn6Hb3Nx4N8iNATOWpUJX4DMKczbuEkaJTuOV4KGhbLJ_dMto1; ASP.NET_SessionId=215logkl5igi3cw4w3krqojm; ylcfopenpayadmin=PaSJqNorEYVA24+7BV+HDVmAgUGn73zY14FBFnSCRAtdcbYgW7R0PQxVAjPsi52IiqQnhdC7Xl3k9wsXpWv04AXfeHIHHs7GZ10lbXu6wXU/3U2GWrfi7UhAVSOw9cLrFQfTSlicDIgSFcg1IC5a741eaNFTXbzn'
  })

  //请求拦截
  instance.interceptors.request.use(config => {
    return config
  }, err => {
    console.log(err)
  })

  //响应拦截
  instance.interceptors.response.use(res => {
    return res.data
  }, err => {
    console.log(err);
  })

  return instance(config)
}
